package entity;

public class Student {
    private String studentId; // 学生编号
    private String studentName; // 学生姓名
    private String gender; // 性别
    private Course selectedCourse; // 已选课程

    // 构造方法：初始化学生信息
    public Student(String studentId, String studentName, String gender) {
        this.studentId = studentId;
        this.studentName = studentName;
        this.gender = gender;
    }

    // 选课方法
    public void selectCourse(Course course) {
        this.selectedCourse = course;
    }

    // 退课方法
    public void dropCourse() {
        this.selectedCourse = null;
    }

    // 获取已选课程
    public Course getSelectedCourse() {
        return selectedCourse;
    }

    // 获取学生编号、姓名、性别
    public String getStudentId() {
        return studentId;
    }
    public String getStudentName() {
        return studentName;
    }
    public String getGender() {
        return gender;
    }

    // 打印学生信息时显示的内容
    @Override
    public String toString() {
        return "Student{" +
                "学生编号='" + studentId + '\'' +
                ", 学生姓名='" + studentName + '\'' +
                ", 性别='" + gender + '\'' +
                ", 已选课程=" + selectedCourse +
                '}';
    }
}